<template>
  <fieldset>
    <legend>Child组件</legend>
    <h1>Child组件</h1>
    <h2>来自父组件的数据：{{ g }}</h2>
    <button @click="send">点击传递给父组件</button>
  </fieldset>
</template>

<script>
export default {
  data() {
    return {
      h: "脑白金",
    };
  },
  props: {
    g: {
      type: String,
    },
  },
  methods: {
    send() {
      this.$emit("re", this.h);
    },
  },
  mounted() {
    this.$bus.$on("get2", (input) => {
      console.log(input);
    });
  },
};
</script>
